﻿using System.Collections.Generic;

namespace SharePoint.Contrib.ApplicationSettings
{
    /// <summary>
    /// Represents a collection of settings
    /// </summary>
    public interface ISettingsCollection : IEnumerable<Setting>
    {
        /// <summary>
        /// Retrieves a setting by specifying its ID (key).
        /// </summary>
        /// <param name="id">Setting: key</param>
        Setting<T> FindById<T>(string id);

        /// <summary>
        /// Add a new setting
        /// </summary>
        /// <param name="instance">The instance to add</param>
        void Add(Setting instance);

        /// <summary>
        /// Update a setting
        /// </summary>
        /// <param name="instance">Updates the setting</param>
        void Update(Setting instance);

        /// <summary>
        /// Deletes a setting
        /// </summary>
        /// <param name="instance">The instance to delete</param>
        void Delete(Setting instance);

        /// <summary>
        /// Deletes a setting with the specified id (key)
        /// </summary>
        /// <param name="id">Setting: key</param>
        void Delete(string id);
    }
}
